package com.company.cloud.behavior.modules.api.response;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

import com.company.cloud.common.tree.TreeEntityModel;

import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class CommentModel implements TreeEntityModel {

	
	@ApiModelProperty(value = "ID")
	private Integer id;

	@ApiModelProperty(value = "公司编号")
	private String companyNo;

	@ApiModelProperty(value = "用户ID")
	private Integer userId;

	@ApiModelProperty(value = "用户名")
	private String userName;

	@ApiModelProperty(value = "昵称")
	private String userNickName;

	@ApiModelProperty(value = "头像URL")
	private String userHeadUrl;

	@ApiModelProperty(value = "评论对象类型")
	private String objType;

	@ApiModelProperty(value = "评论对象编号")
	private String objNo;

	@ApiModelProperty(value = "评论内容")
	private String content;

	@ApiModelProperty(value = "评论图片")
	private List<String> image;


	@ApiModelProperty(value = "评论时间")
	private LocalDateTime commentTime;

	@ApiModelProperty(value = "上级评论ID")
	private Integer parentId;

	@ApiModelProperty(value = "子评论")
	private List<CommentModel> children;

	public void addChildren(CommentModel model) {
		if (this.children == null) {
			this.children = new ArrayList<CommentModel>();
		}
		if (model != null) {
			this.children.add(model);
		}
	}

	@Override
	public void addChild(TreeEntityModel obj) {
		if(this.children==null){
			this.children=new ArrayList<CommentModel>();
		}
		if(obj!=null && obj instanceof  CommentModel){
			this.children.add((CommentModel)obj);
		}
	}

	@ApiModelProperty(value = "评论的点赞信息")
	private ThumbsUpSearchModel thumbsUpSearchModel;
}
